diff --git a/src/Controller/TYPProfileController.php b/src/Controller/TYPProfileController.php new file mode 100644 --- /dev/null +++ b/src/Controller/TYPProfileController.php @@ -0,0 +1,41 @@ +redirect(""); + }*/ + + public function profilePage($bizid){ + $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); + $data = \Drupal::service("typ.search")->getProfile($bizid ,AUTO); + if (!$data) { + return $this->redirect(""); + } + + $dataproddesct = html_entity_decode($data['proddesc']); +// echo "
";
+//        var_export($data);
+//        exit;
+        $display[] = array(
+            '#theme' => 'typ_profile',
+            '#profile' => $data,
+            '#prodescription' => $dataproddesct,
+        );
+        return $display;
+	}
+}
\ No newline at end of file
diff --git a/templates/typ-profile.html.twig b/templates/typ-profile.html.twig
new file mode 100644
--- /dev/null
+++ b/templates/typ-profile.html.twig
@@ -0,0 +1,170 @@
+{% set base_images = 'http://media.yellowpages.co.th/yellowpages'%}
+
+
+ +
+
+
+ +
+
+

{{ profile.custname|raw }}

+ หมวดหมู่ : {{ profile.headingname|raw }}
+ ไม่สามารถคะแนนได้ +
+
+
+ +
+
+
+ {% trans %} Address {% endtrans %} [ + {% trans %}View map{% endtrans %}{{ profile.custname|raw }} ]
+ {{ [profile.addr,profile.soi,profile.road,profile.subdistrictname, + profile.districtname,profile.cityname,profile.postcode]|join(' ') }} +

+ +
+
+ {% if not profile.telno %}{% else %}{% trans %} Tel {% endtrans %}
{% endif %} + {% if not profile.fax %}{% else %}{% trans %} Fax {% endtrans %}
{% endif %} + {% if not profile.email %}{% else %}{% trans %} Email {% endtrans %}
{% endif %} + {% if not profile.website %}{% else %}{% trans %} Website {% endtrans %}
{% endif %} + {% if not profile.workinghours %}{% else %}{% trans %} Work-Time {% endtrans %}{% endif %} +
+
+ {% if not profile.telno %} + {% else %} + {% for key, tel in profile.telno %} + {% if loop.last != key+1 %}{{ tel }}{{ " ," }} + {% else %}{{ tel }}{% endif %} + {% endfor %}
+ {% endif %} + + {% if not profile.fax %} + {% else %} + {% for key, tel in profile.fax %} + {% if loop.last != key+1 %}{{ tel }}{{ " ," }} + {% else %}{{ tel }}{% endif %} + {% endfor %}
+ {% endif %} + + {% if not profile.email %} + {% else %} + {{ profile.email }}
+ {% endif %} + + {% if not profile.website %} + {% else %} + {{ profile.website }}
+ {% endif %} + + {% if not profile.workinghours %} + {% else %} + {{ profile.workinghours }}
+ {% endif %} +
+
+
+ {% if not prodescription %} + {% else %} +
{% trans %} Product And Service {% endtrans %}

+ {{ prodescription|replace({"

":" ","

":" "}) }}
+ {% endif %} + + {% if not profile.brandname %} + {% else %}
{% trans %} Branner {% endtrans %} : {{ profile.brandname|replace({"

":" ","

":" "}) }} + {% endif %} +


+ {# TAB #} +
+ + +
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+ + + +
+
+ + +


+ {% if not profile.custname %} + {% else %} + {{ profile.custname|raw }} : แสดงความคิดเห็น + {% endif %} +

+ + {# TAB #} +
+ + +
+ + + +
+
+ {# END TAB #} +

+
+
+
+
+
+
+ +
+
+ ADS +
+
+
diff --git a/typ_profile.info.yml b/typ_profile.info.yml new file mode 100644 --- /dev/null +++ b/typ_profile.info.yml @@ -0,0 +1,11 @@ +name: TYP Profile +type: module +description: 'TYP Profile' +package: TYP +# core: 8.x +# Information added by Drupal.org packaging script on 2015-02-17 +version: '8.x-1.x-dev' +core: '8.x' +project: 'typ_profile' +dependencies: + - typ_search diff --git a/typ_profile.module b/typ_profile.module new file mode 100644 --- /dev/null +++ b/typ_profile.module @@ -0,0 +1,41 @@ + array( + 'variables' => array( + 'profile' => NULL, + 'prodescription' => NULL + ) + ) + ); +} diff --git a/typ_profile.routing.yml b/typ_profile.routing.yml new file mode 100644 --- /dev/null +++ b/typ_profile.routing.yml @@ -0,0 +1,15 @@ +typ_profile_search: + path: '/profile/{bizid}' + defaults: + _controller: '\Drupal\typ_profile\Controller\TYPProfileController::profilePage' + _title: 'View Profile' + requirements: + _permission: 'access content' + +#typ_profile_redirect: +# path: '/profile' +# defaults: +# _controller: '\Drupal\typ_profile\Controller\TYPProfileController::profileOverview' +# _title: 'Rredirect ' +# requirements: +# _permission: 'access content' \ No newline at end of file